package cn.iocoder.yudao.module.resource.dal.mysql.timepackage;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.resource.controller.admin.timepackage.vo.TimePackagePageReqVO;
import cn.iocoder.yudao.module.resource.dal.dataobject.timepackage.TimePackageDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 时长套餐 Mapper
 *
 * @author lizhongwen
 */
@Mapper
public interface TimePackageMapper extends BaseMapperX<TimePackageDO> {

    default PageResult<TimePackageDO> selectPage(TimePackagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TimePackageDO>()
                .eqIfPresent(TimePackageDO::getId, reqVO.getId())
                .eqIfPresent(TimePackageDO::getListingStatus, reqVO.getListingStatus())
                .likeIfPresent(TimePackageDO::getPackageName, reqVO.getPackageName())
                .orderByDesc(TimePackageDO::getId));
    }

}